using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableFishSkillDao:DaoBase<TableFishSkill>
    {
        public override void AddPrimaryIndex(TableFishSkill model)
        {
            cachePrimary[model.FishItemID.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableFishSkill.txt";
        }

        protected override TableFishSkill ParseRowData(string[] rowData)
        {
            TableFishSkill data = new TableFishSkill();
			data.FishItemID = rowData [0];
			data.Name = rowData [1];
			data.Desc = rowData [2];
			data.Type = rowData [3];

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.Quality = 0;
            }
            else
            {
                data.Quality = int.Parse(rowData[4]);
            }
			data.ValueType = rowData [5];
			data.Value = rowData [6];

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.LevelLimit = 0;
            }
            else
            {
                data.LevelLimit = int.Parse(rowData[7]);
            }
			data.SkillNeeded = rowData [8];

            if (string.IsNullOrEmpty(rowData[9]))
            {
                data.MakingExp = 0;
            }
            else
            {
                data.MakingExp = int.Parse(rowData[9]);
            }
			data.Product = rowData [10];
			data.Material = rowData [11];

            return data;
        }


        public override void AddOneIndex(TableFishSkill model)
        {
            if (!cacheOneIndex.ContainsKey(model.Type.ToString()))
            {
                cacheOneIndex[model.Type.ToString()] = new List<TableFishSkill>();
            }
            cacheOneIndex[model.Type.ToString()].Add(model);
        }
    

    }

}
